<!DOCTYPE html>
<html>
<head>
    <title>后台管理系统</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="/static/Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="/static/Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="/static/Css/style.css" />
    <script type="text/javascript" src="/static/Js/jquery.js"></script>
    <script type="text/javascript" src="/static/Js/bootstrap.js"></script>
    <script type="text/javascript" src="/static/Js/ckform.js"></script>
    <script type="text/javascript" src="/static/Js/common.js"></script>
    <style type="text/css">
        body {
            padding-top: 40px;
            padding-bottom: 40px;
            background-color: #f5f5f5;
        }

        .form-signin {
            max-width: 300px;
            padding: 19px 29px 29px;
            margin: 0 auto 20px;
            background-color: #fff;
            border: 1px solid #e5e5e5;
            -webkit-border-radius: 5px;
            -moz-border-radius: 5px;
            border-radius: 5px;
            -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
            -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
            box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
        }

        .form-signin .form-signin-heading,
        .form-signin .checkbox {
            margin-bottom: 10px;
        }

        .form-signin input[type="text"],
        .form-signin input[type="password"] {
            font-size: 16px;
            height: auto;
            margin-bottom: 15px;
            padding: 7px 9px;
        }

        input,img{
            vertical-align: middle;
        }

        img{
            height: 36px;
            width: 125px;
            margin-bottom: 15px;
            cursor: pointer;
        }
    </style>
</head>
<body>
<div class="container">

    <div class="form-signin">
        <h2 class="form-signin-heading">登录系统</h2>
        <input type="text" id="txtusername" class="input-block-level" placeholder="账号">
        <input type="password" id="txtuserpwd" class="input-block-level" placeholder="密码">
        <input type="text" id="txtverify" class="input-medium" placeholder="验证码" maxlength="5">&nbsp;<img src="/account/verify" title="看不清吗？点击切换" onclick="this.src='/account/verify?id='+Math.random()" />

        <p><button class="btn btn-large btn-primary" type="button" onclick="btn_login()">登录</button></p>
    </div>

</div>

<script type="text/javascript">
    function btn_login(){

        var username = $("#txtusername").val();
        if(username==""||username==null){
            $("#txtusername").focus();
            return;
        }

        var userpwd = $("#txtuserpwd").val();
        if(userpwd==""||userpwd==null){
            $("#txtuserpwd").focus();
            return;
        }

        var verify = $("#txtverify").val();
        if(verify==""||verify==null){
            $("#txtverify").focus();
            return;
        }

        $.post("/account/login",{username:username,userpwd:userpwd,verify:verify},function(serverData){
            if(serverData.status==0){
                alert('登录成功！');
                window.location = '/';
            }else if(serverData.status==2){
                alert('验证码错误！');
            }else{
                alert(serverData.msg);
            }
            $("img").attr("src","/account/verify?id="+Math.random());
        });

    }
</script>

</body>
</html>